<?php

namespace ctrl\demo;

class eccang
{
    //测试拉取仓库列表 //http://ec.com/?c=demo_eccang&a=warehouse
    public static function warehouse()
    {
        \serv\task\warehouse\eccang::warehouseList();
    }

    //测试拉取仓库列表 //http://ec.com/?c=demo_eccang&a=warehouseQueue
    public static function warehouseQueue()
    {
        $string = '{"warehouse_status":"1","warehouse_type":2,"warehouse_name":"谷仓捷克仓","warehouse_code":"YC-GU-CZ","warehouse_id":"1"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\eccang::warehouseList($data);
        var_dump($result);
    }

    //拉取仓库详情 //http://ec.com/?c=demo_eccang&a=warehouseDetail
    public static function warehouseDetail()
    {
        \serv\task\warehouse\eccang::warehouseDetail();
    }

    //拉取仓库详情 //http://ec.com/?c=demo_eccang&a=warehouseDetailQueue
    public static function warehouseDetailQueue()
    {
        $string = '{"warehouse_code_list":["YC-GU-CZ","YC-GU-USEA","YC-GU-USWC","YC-GU-UK","YC-WT-USKY","YC-WT-USTX","YC-WT-USWC","YC-WT-AUME","YC-WT-AU","YC-WT-UK","YC-WT-UKMA","YC-WT-UKGF","YC-CN","YC-FBA-US","YC-FBC-FR","FurgleHomeAU","EchampUK","Echamp","FurgleAU","RimdocUK"]}';
        $data['data'] = json_decode($string, true);
        \serv\queue\warehouse\eccang::warehouseDetail($data);
    }

    //同步库存 //http://ec.com/?c=demo_eccang&a=pull
    public static function pull()
    {
        \serv\task\warehouse\eccang::pull();
    }

    //测试拉取库存信息 //http://ec.com/?c=demo_eccang&a=pull
    public static function pullQueue()
    {
        $string = '{"id":"1","warehouse_id":"1","warehouse_code":"YC-GU-CZ"}';
        $data['data'] = json_decode($string, true);
        \serv\queue\warehouse\eccang::pull($data);
    }

    //测试拉取库存信息 //http://ec.com/?c=demo_eccang&a=checkStock
    public static function checkStock()
    {
        $string = '{"product_sku":"B002002-NA-SG","product_sku_title":"\u5e8a\u4e0a\u4e09\u4ef6\u5957-\u7f0e\u7eb9-navy blue-Single","quantity":"10","warehouse_name":"\u56fd\u5185\u4e2d\u8f6c\u4ed3","warehouse_code":"YC-CN","area_type_cn":"\u5b58\u50a8\u533a","area_type":"2","out_quantity":0,"product_sku_en_title":"Bed Sheet Set","lc_code":"YC-013","warehouse_id":"13"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\warehouse\eccang::checkStock($data);
        var_dump($result);
    }

    //测试拉取库存信息 //http://ec.com/?c=demo_eccang&a=checkProduct
    public static function checkProduct()
    {
        $string = '{"product_sku":"B002002-NA-SG","product_sku_title":"\u5e8a\u4e0a\u4e09\u4ef6\u5957-\u7f0e\u7eb9-navy blue-Single","quantity":"10","warehouse_name":"\u56fd\u5185\u4e2d\u8f6c\u4ed3","warehouse_code":"YC-CN","area_type_cn":"\u5b58\u50a8\u533a","area_type":"2","out_quantity":0,"product_sku_en_title":"Bed Sheet Set","lc_code":"YC-013","warehouse_id":"13"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\product\product::index($data);
        var_dump($result);
    }

    //拉取区域列表  //http://ec.com/?c=demo_eccang&a=areaList
    public static function areaList()
    {
        $data['data'] = [
            'warehouse_id' => 58
        ];
        \serv\queue\warehouse\eccang::areaList($data);
    }


    //拉取库位列表  //http://ec.com/?c=demo_eccang&a=positionList
    public static function positionList()
    {
        $data['data'] = [
            'warehouse_id' => 58
        ];
        \serv\queue\warehouse\eccang::positionList($data);
    }

    //获取用户列表  //http://ec.com/?c=demo_eccang&a=getUser
    public static function getUser()
    {
        \serv\task\warehouse\eccang::getUser();
    }

    //获取精简订单列表  //http://ec.com/?c=demo_eccang&a=getOrderListLite
    public static function getOrderListLite()
    {
        \serv\task\warehouse\eccang::getOrderListLite();
    }

    //获取订单列表  //http://ec.com/?c=demo_eccang&a=getOrderList
    public static function getOrderList()
    {
        \serv\task\warehouse\eccang::getOrderList();
    }

    //计算库存  //http://ec.com/?c=demo_eccang&a=calcStock
    public static function calcStock()
    {
        \serv\task\warehouse\eccang::calcStock();
    }

    //获取出库订单明细 //http://ec.com/?c=demo_eccang&a=orderWarehouse
    public static function orderWarehouse()
    {
        $string = '{"product_count":"1","abnormal_reason":"","platform_ship_status":"1","warehouse_ship_date":"2024-08-13 00:25:23","seller_rebate":"0.00","create_type":"api","buyer_name":"Bradford","outbound_batch_carrier":"","bill_no":"","buyer_id":"bradford","date_create_sys":"2024-08-08 21:32:41","customer_service_note":"","shipping_method":"KCL-FEDEX-USNJ-1","fba_fee":"0.000","track_status":"","order_weight":"19.1000","system_tag_zh":"","service_number":"43015223","order_type":"sale","refrence_no":"113-1603840-9685804","platform_paid_date":"2024-08-08 06:01:10","is_replacement_order":0,"process_again":"1","date_create_platform":"2024-08-08 06:01:10","custom_tag_en":"","paypal_account":"","tax":"12.750","update_date":"2024-08-13 01:11:21","refrence_no_sys":"SYS0162408080355","order_code":"113-1603840-9685804","ship_fee":"20.000","country_code":"US","fulfillment_type":0,"track_delivered_time":"","subtotal":"182.740","amountpaid":"202.740","amazon_order_note":"","order_id":"5068440","status":"4","paypal_transaction_id":"","platform_ship_date":"2024-08-13 00:23:23","shipping_method_no":"777910028590","platform_fee_total":"0.000","warehouse_code":"YC-KCL-USNJ","abnormal_type":"0","custom_order_type":"","is_cod":"0","order_details":[{"product_sku_info":"A000055-LBN-B*1*100","product_url":"https:\/\/www.amazon.com\/dp\/B0BWYDCXCF","unit_finalvaluefee":"28.500","op_site":"US","pic":"https:\/\/m.media-amazon.com\/images\/I\/41HBjJGFd8L.jpg","team_id":"4543","op_ref_item_id":"106909948028641","update_time":"2024-08-08 21:32:40","action":"0","platform_sku":"A000055-LBN-B-193US-V01","product_sku_qty_list":"A000055-LBN-B*1","product_sku_org_qty":"1","op_ref_item_location":"B0BWYDCXCF","warehouse_sku_list":[{"product_level":"","warehouse_sku":"A000055-LBN-B","warehouse_sku_qty":1}],"buyer_customized_info_url":"","promotion_id_list":[],"item_price":169.99,"order_code_org":"113-1603840-9685804","product_sku_org":"A000055-LBN-B-193US-V01","op_id":"5274862","original_unit_price":"169.99","unit_price":"182.740","unit_platformfee":"0.000","product_title":"VOMXUF Mid Century Modern Shell Lounge Chair, Faux Leather, Scandinavian Furniture Tripod Plywood Classic Design Solid Wood Accent Chairs for Living Room, Reading, Lounge, Office, Salon","team_name":"佛山亚马逊","order_code":"113-1603840-9685804","item_withheld_tax":12.75,"product_sku_list":"A000055-LBN-B","op_ref_tnx":"106909948028641","qty":"1","properties":"","promotion":25.5}],"platform":"amazon","custom_tag_zh":"","is_business_order":"0","order_address":{"shipping_address_id":"5066801","update_date":"2024-08-09 00:20:30","country_code":"US","city_name":"JACKSONVILLE","phone":"1480618534499535","company_name":"","district":"","name":"Bradford Mullins XMITYT","country_name":"UNITED STATES","state":"FL","created_date":"2024-08-09 00:20:30","line3":"","postal_code":"32256-6815","line2":"","line1":"7658 PHILIPS HWY STE 100"},"company_code":"echamp","currency":"USD","creater_user_code":"","is_mark":"0","warehouse_order_code":"AM24081250023","other_fee":"12.750","buyer_mail":"8kc7yvl2rhqqg94@marketplace.amazon.com","system_tag_en":"","platform_user_name":"AMZ_FSXHQ_US","is_transfer_fba_delivery":"0","discount_val":"","platform_latest_ship_date":"2024-08-13 14:59:59","shipping_method_platform":"Standard","order_desc":"","creater_user_name_en":"system","finalvalue_fee_total":"28.500","creater_user_name":"系统","site":"Amazon.com","date_create":"2024-08-08 21:01:10","outbound_batch_tracking_no":"","buyer_tax_registration_id":"","user_account":"FSXHQ_US","cost_ship_fee":"37.504","warehouse_id":"130"}';
        $data['data'] = json_decode($string, true);
        \serv\queue\warehouse\eccang::orderWarehouse($data);
    }

    //获取仓发订单信息  //http://ec.com/?c=demo_eccang&a=getOrderInfo
    public static function getOrderInfo()
    {
        $warehouse_order_code = 'SO24081230038';
        \serv\task\warehouse\eccang::getOrderInfo($warehouse_order_code);
    }

    //获取头程总单列表 //http://ec.com/?c=demo_eccang&a=getTransferBatchList
    public static function getTransferBatchList()
    {
        \serv\task\warehouse\eccang::getTransferBatchList();
    }

    //获取产品列表 //http://ec.com/?c=demo_eccang&a=productList
    public static function productList()
    {
        \serv\task\warehouse\eccang::productList();
    }

    //产品队列 //http://ec.com/?c=demo_eccang&a=productListQueue
    public static function productListQueue()
    {
        $string = '{"product_net_weight":"0.000","product_height":"27.50","defaul_buy_warehouse_id":"0","ean_code":"","hs_code":"","ppn_release_date":"","product_color_name":"","seller_id":"","person_seller_id":"0","product_size_name":"","product_width":"37.50","is_combination":"0","procut_category_name3":"工具套装","procut_category_name2":"其他","product_package":[],"pu_code":"","product_title":"工具组套-990pcs","is_gift":"0","procut_category_name1":"其他线","supplier_sku":"","is_qc":"0","product_size_id":"0","opration_type":"2","person_develop_id":"0","logistic_attribute":"0","pd_declare_currency_code":"USD","product_weight":"15.800","prl_id":"0","procut_category_code3":"850","product_status":"1","procut_category_code2":"808","person_oprater_id":"587","procut_category_code1":"719","currency_code":"USD","product_images":" http://erp-huanan.oss-cn-shenzhen.aliyuncs.com/wms/echamp/jpg/2021/07/02/echamp_202107021043284kmmm.jpg,http://erp-huanan.oss-cn-shenzhen.aliyuncs.com/wms/echamp/jpg/2021/07/02/echamp_20210702104336vvn3z.jpg,http://erp-huanan.oss-cn-shenzhen.aliyuncs.com/wms/echamp/jpg/2021/07/02/echamp_20210702104343ag5ih.jpg","product_sku":"2G010030","product_specs":"","pd_oversea_type_cn":"工具组套","user_organization_id":"0","product_size_name_en":"","product_color_name_en":"","default_supplier_code":"YCJX","default_warehouse_id":"0","sp_unit_price":"52.0000","product_declared_value":"31.20","warehouse_barcode":"","sale_status":"1","ref_url":"","designer_id":"0","pd_oversea_type_en":"tool case","product_cost":[],"suggest_price_currency_code":"","product_spu":"","product_color_id":"0","product_title_en":"tool case","product_length":"53.00","is_exp_date":"0","product_update_time":"2023-06-21 14:43:44","product_add_time":"2019-05-22 11:56:06"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\product\product::index($data);
        var_dump($result);
    }

    //获取产品列表 //http://ec.com/?c=demo_eccang&a=categoryList
    public static function categoryList()
    {
        \serv\task\warehouse\eccang::categoryList();
    }

    //获取产品分类 //http://ec.com/?c=demo_eccang&a=categoryListQueue
    public static function categoryListQueue()
    {
        $string = '{"pc_name":"高定线","pc_pid":"0","pc_level":"0","pc_reference_code":"","pc_hs_code":"","pc_update_time":"2023-05-23 20:20:22","user_organization_id":"0","pc_name_en":"高定线","pc_sort_id":"0","warehouse_id":"0","pc_shortname":"714","pc_id":"714"}';
        $data['data'] = json_decode($string, true);
        $result = \serv\queue\product\product::categoryList($data);
        var_dump($result);
    }

    //数组转json //http://ec.com/?c=demo_eccang&a=test
    public static function test()
    {
        $row = [
            [
                "belong"  => 1,
                "data" => [
                    [
                        "sku" => 'A0000242D-DZJ-KDA',
                        "qty" => 50
                    ]
                ]
            ]
        ];
        echo json_encode($row); exit;
        $team = [
            [
                "label" => "eBay",
                "value" => [
                    "EB" => 'eBay'
                ]
            ],
            [
                "label" => "速卖通",
                "value" => [
                    "AE" => 'Aliexpress'
                ]
            ],
            [
                "label" => "Walmart",
                "value" => [
                    "WM" => 'Walmart'
                ]
            ],
            [
                "label" => "佛山亚马逊",
                "value" => [
                    "AM" => 'Amazon'
                ]
            ],
            [
                "label" => "个护组-亚马逊",
                "value" => [
                    "AM" => 'Amazon'
                ]
            ],
            [
                "label" => "Mydeal",
                "value" => [
                    "MY" => 'Mydeal'
                ]
            ],
            [
                "label" => "CD",
                "value" => [
                    "CD" => 'CD'
                ]
            ],
            [
                "label" => "Overstock",
                "value" => [
                    "OS" => 'Overstock'
                ]
            ],
            [
                "label" => "Temu",
                "value" => [
                    "OS" => 'TU'
                ]
            ],
            [
                "label" => "wayfair",
                "value" => [
                    "WF" => 'wayfair'
                ]
            ],
            [
                "label" => "Shein",
                "value" => [
                    "SN" => 'Shein'
                ]
            ],
            [
                "label" => "独立站",
                "value" => [
                    "SF" => '独立站'
                ]
            ],
        ];
        echo json_encode($team, JSON_UNESCAPED_UNICODE);
        exit;
    }
}
